Implementing Continuation Marks in JavaScript
نویسندگان
چکیده
MzScheme’s continuation marks provide a flexible mechanism for implementing a number of useful language features and tools. We demonstrate the simplicity and utility of continuation marks by adapting them for JavaScript as frame-based stack marks using the Rhino implementation, showing a simple model of their behavior, and using them to build a toy debugger. Along the way, we discover a few interesting things. First, it requires some thinking—but not much code—to add continuation marks to JavaScript. Second, coupling tail-calling with the “return” of statement-based languages leads to some interesting problems in formulating a semantics. Third, building a debugger based on continuation marks highlights (by its absence) the elegance of Scheme’s simple syntax and hygienic macro system.
منابع مشابه
Embedding Watermark: the way to improve Security
Digital watermarking is a process of embedding unobtrusive marks or labels into digital content. These embedded marks are typically imperceptible (invisible) that can later be detected or extracted. This paper describes watermarking process and attacks on watermarks. Also a focus is made on various techniques of implementing watermarks. In general, any watermarking scheme consists of three part...
متن کاملExceptional Continuations in JavaScript
JavaScript, the main language for web-site development, does not feature continuation. However, as part of client-server communication they would be useful as a means to suspend the currently running execution. In this paper we present our adaption of exception-based continuations to JavaScript. The enhanced technique deals with closures and features improvements that reduce the cost of the wor...
متن کاملA CPS-like Transformation of Continuation Marks
A CPS-like Transformation of Continuation Marks Kimball R. GermaneDepartment of Computer Science, BYUMaster of Science Continuation marks are a programming language feature which generalize stackinspection. Despite its usefulness, this feature has not been adopted by languages which relyon stack inspection, e.g., for dynamic security checks. One reason for this neglect may be<lb...
متن کاملJ Is for JavaScript: A Direct-Style Correspondence between Algol-Like Languages and JavaScript Using First-Class Continuations
It is a time-honored fashion to implement a domain-specific language (DSL) by translation to a general-purpose language. Such an implementation is more portable, but an unidiomatic translation jeopardizes performance because, in practice, language implementations favor the common cases. This tension arises especially when the domain calls for complex control structures. We illustrate this tensi...
متن کاملLinks: Web Programming Without Tiers
Links is a programming language for web applications that generates code for all three tiers of a web application from a single source, compiling into JavaScript to run on the client and into SQL to run on the database. Links supports rich clients running in what has been dubbed ‘Ajax’ style, and supports concurrent processes with statically-typed message passing. Links is scalable in the sense...
متن کامل